﻿using EMS.Model;
using EMS.View;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Models;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
namespace EMS.ViewModel
{
    
    public class MainViewModel : ViewModelBase
    {
       

        public AppData AppData { get; private set; } = AppData.Instance;
        public MainViewModel()
        {
          
        }

        /// <summary>
        /// 选择不同的view
        public RelayCommand<RadioButton> SelectViewCommand
        {
            get
            {
                return new RelayCommand<RadioButton>((arg) =>
                {
                    if (!(arg is RadioButton button)) return;
                    if (string.IsNullOrEmpty(button.Content.ToString())) return;
                    //页面切换
                    switch (button.Content.ToString())
                    {
                        case "首页": AppData.Instance.MainWindow.container.Content = new IndexView(); break;
                        case "出入库": AppData.Instance.MainWindow.container.Content = new RecordView(); break;
                        case "物资管理": AppData.Instance.MainWindow.container.Content = new CargoView(); break;
                        case "用户管理": AppData.Instance.MainWindow.container.Content = new MemberView(); break;
                        case "类型设置": AppData.Instance.MainWindow.container.Content = new CargoTypeView(); break;
                        default:
                            break;
                    }

                });
            } 
            
           
        }

    }
}